package com.example.skyline.controller;

import cn.hutool.crypto.SecureUtil;
import com.example.skyline.Utils.CipherUtils;
import com.example.skyline.common.Result;
import com.example.skyline.entity.User;
import com.example.skyline.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("/web")
public class WebController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        return Result.success(userService.login(user));
    }

    @PostMapping("/register")
    public Result register(@RequestBody User user) {
        userService.register(user);
        return Result.success("注册成功");
    }

    @GetMapping("/test")
    public Result test() {
        User user = new User();
        user.setUsername("admin");
        user.setPassword("123456@test.com");
        return Result.success(user);
    }


}
